﻿#region Usings&Copyright
/*================================================
 *= TemplateWriter.cs (c)2009 Eagle Eye Studios  =
 *=         Written by Florian Vick              =
 *================================================
 */
using System;
using System.Collections.Generic;
using System.Text;
using Nini.Config;
#endregion

namespace Astudio.FileManagement.Template
{
    /// <summary>
    /// A Class that reads a configFile using Nini.config.DotNetConfigSource
    /// </summary>
    public class TemplateWriter
    {
        #region Variables
        DotNetConfigSource writer;
        #endregion

        #region Methods
        /// <summary>
        /// Creates a new Instance of the TemplateWriter Class
        /// </summary>
        public TemplateWriter()
        {
            writer = new DotNetConfigSource();
            writer.AddConfig("Template");
        }

        /// <summary>
        /// Saves the Path of the BackgroundPic
        /// </summary>
        /// <param name="Path">Path of BG File</param>
        public void WriteBackgroundPicPath(string Path)
        {
            writer.Configs["Template"].Set("BackgroundPicture",Path.ToString());
        }

        /// <summary>
        /// Writes the Name of the Template
        /// </summary>
        /// <param name="Name">Name of Template</param>
        public void WriteTemplateName(string Name)
        {
            writer.Configs["Template"].Set("TemplateTitle", Name);
        }

        /// <summary>
        /// Writes a specific TemplateVersion
        /// </summary>
        /// <param name="Major">Major Version</param>
        /// <param name="Minor">Minor Version</param>
        public void WriteTemplateVersion(int Major, int Minor)
        {
            writer.Configs["Template"].Set("TemplateVersion", Major.ToString() + "." + Minor.ToString());
        }

        /// <summary>
        /// Writes the Position of the Template Heading
        /// </summary>
        /// <param name="X">X Position</param>
        /// <param name="Y">Y Position</param>
        public void WriteHeadingPosition(int X, int Y)
        {
            writer.Configs["Template"].Set("HeadingPositionX", X.ToString());
            writer.Configs["Template"].Set("HeadingPositionY", Y.ToString());
        }

        /// <summary>
        /// Writes the Font of Menu's Heading
        /// </summary>
        /// <param name="Fontname">Name of the used Font</param>
        public void WriteHeadingFont(string Fontname)
        {
            writer.Configs["Template"].Set("HeadingFont", Fontname.ToString());
        }

        /// <summary>
        /// Writes the Heading's Fontsize
        /// </summary>
        /// <param name="Fontsize">The Fontsize</param>
        public void WriteHeadingFontSize(int Fontsize)
        {
            writer.Configs["Template"].Set("HeadingFontSize", Fontsize.ToString());
        }

        /// <summary>
        /// Writes the Slogan's Position
        /// </summary>
        /// <param name="X">X Pos</param>
        /// <param name="Y">Y Pos</param>
        public void WriteSloganPosition(int X, int Y)
        {
            writer.Configs["Template"].Set("SloganPositionX", X.ToString());
            writer.Configs["Template"].Set("SloganPositionY", Y.ToString());
        }

        /// <summary>
        /// Writes the Slogan's Font's Name ;)
        /// </summary>
        /// <param name="Fontname">The Fontname</param>
        public void WriteSloganFont(string Fontname)
        {
            writer.Configs["Template"].Set("SloganFont", Fontname.ToString());
        }

        /// <summary>
        /// Writes the Slogan's Font's Size (xD)
        /// </summary>
        /// <param name="Fontsize">The Fontsize</param>
        public void WriteSloganFontSize(int Fontsize)
        {
            writer.Configs["Template"].Set("SloganFontSize", Fontsize.ToString());
        }

        /// <summary>
        /// Writes the Position of MainLabel
        /// </summary>
        /// <param name="X">X Position</param>
        /// <param name="Y">Y Position</param>
        public void WriteMainLabelPosition(int X, int Y)
        {
            writer.Configs["Template"].Set("MainLabelPositionX", X.ToString());
            writer.Configs["Template"].Set("MainLabelPositionY", Y.ToString());
        }

        /// <summary>
        /// Writes The Font of The MainLabel
        /// </summary>
        /// <param name="Font">The Font</param>
        public void WriteMainLabelFont(string Font)
        {
            writer.Configs["Template"].Set("MainLabelFont", Font.ToString());
        }

        /// <summary>
        /// Writes the MainLabel's Fontsize
        /// </summary>
        /// <param name="Fontsize">Fontsize</param>
        public void WriteMainLabelFontSize(int Fontsize)
        {
            writer.Configs["Template"].Set("MainLabelFontSize", Fontsize);
        }

        /// <summary>
        /// writes the HPLabel Position
        /// </summary>
        /// <param name="X">X Pos</param>
        /// <param name="Y">Y Pos</param>
        public void WriteHPLabelPosition(int X, int Y)
        {
            writer.Configs["Template"].Set("HPLabelPositionX", X.ToString());
            writer.Configs["Template"].Set("HPLabelPositionY", Y.ToString());
        }

        /// <summary>
        /// Writes HPLabel Font and Fontsize
        /// </summary>
        /// <param name="Fontname">Fontname</param>
        /// <param name="Size">Fontsize</param>
        public void WriteHPLabelFontAndSize(string Fontname, int Size)
        {
            writer.Configs["Template"].Set("HPLabelFont", Fontname);
            writer.Configs["Template"].Set("HPLabelFontSize", Size);
        }

        /// <summary>
        /// Writes all data to a File
        /// </summary>
        /// <param name="Path">Path of the File</param>
        public void FlushToFile(string Path)
        {
            writer.Save(Path);
        }
        #endregion
    }
}
